<template>
  <div>
    <h2>你好我是home组件</h2>
    <button @click="add_num(5)">+</button>
    <button @click="reduce_num(3)">-</button>
    {{ $store.state.num }}
    <hr>
    {{ num }}
    <button @click="set_num_async(10000)">点击发送异步请求 赋值  num</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  data () {
    return {
    }
  },
  methods: {
    ...mapMutations(['add_num', 'reduce_num']),
    ...mapActions(['set_num_async'])
  },
  mounted () {
    console.log(this)
  },
  computed: {
    ...mapState(['num'])
  }
}
</script>

<style lang="scss" scoped>

</style>
